<?php
/**
 * Created by PhpStorm.
 * User: lcz
 * Date: 2018/3/30
 * Time: 9:33
 * 公用控制器
 */
namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Request;

/**
 * 公共数据获取
 */
class Base extends Controller{
	
	public function index(){
	
	}
	
	/**
	 * 获取下级分类
	 */
	public function getNextCategory(){
		$id = input('post.cid', '', 'int');
		
		$list = Db::name('GoodsCategory')->where(['parent_id' => $id])->field('id,name')->select();
		$this->success('查询成功','',$list);
	}
	
	/*
	 * 获取下级地区
	 */
	public function getNextArea(){
		$id = input('post.aid', 0, 'int');
		
		$list = Db::name('area')->where(['parentid' => $id])->field('id,areaname')->select();
		$this->success('查询成功','',$list);
	}


	/**
	 * 获取广告位置
	 */
	public function getPositions(){
		$positions = Db::name('adPosition')->column('id,name');
		echo json_encode($positions);
	}

	/**
	 * 获取广告类型
	 */
	public function getAppclass(){
		$positions = Db::name('appClass')->column('id,name');
		echo json_encode($positions);
	}
}
